<?php
/**
*Smarty plugin
*@package Smarty_ams
*@subpackage plugins
*
*@author:Liu Zhongjie<neojie@263.net>
*@coperation:Beijing Arouter Software Co.Ltd
*@creat Date:2007/07/30
**/

/**
* Smarty {html_banner_ams} function plugin
*
* Type:    function
* Name:    html_banner_ams
* Date:    July 30,2007
* Input:<br>
*         -font         = 文字
*         -button       = 按钮
*         -bannerstyle  = banner条的外观样式
*         -buttonstyle  = 按钮的外观样式
*
* Examples:
* <pre>
* <{html_banner_ams font=$FONT button=$BUTTON}>
* </pre>
* @param array
* @param Smarty
* @return string
**/

function smarty_function_html_tree_ams ($params, &$smarty)
{
	require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
	
	$aStandarChar         = null;
	
	foreach($params as $_key => $_value)
	{
		switch($_key)
		{
			case 'standarchar':
                $aStandarChar = (array)$_value;
                break;
            default:
            	$aStandarChar   = array();
            	break;
		}
	}
	$sOutput     = '<table width="100%" border="0">'."\n";
	$sOutput    .= '<tr>'."\n\t";
	$sOutput    .= '<td>'."\n\t\t";
	
	if (count($aStandarChar) >1)
	{
		for($i = 0; $i < count($aStandarChar); $i++)
		{
			
			if("emp" == $aStandarChar[$i])
			{
				$sOutput    .= '<br>'."\n\t\t";
			}
			else
			{
				$sOutput    .= '<input type="text" name="';
				$sOutput    .= smarty_function_escape_special_chars($aStandarChar[$i]);
				$sOutput    .= '" value="';
				$sOutput    .= smarty_function_escape_special_chars($aStandarChar[$i]);
				$sOutput    .= '" readonly="true">'."\n\t";
			}
			
			
		}
	}
	$sOutput    .= '</td>'."\n\t";
	$sOutput    .= '</tr>'."\n";
	$sOutput    .= '</table>';

	return $sOutput;
}
?>
